package com.neusmart.common.util;

import android.view.View;

/**
 * Created by chris on 15/7/9.
 */
public class ViewUtil {

    /**
     * 测量view，以使用getMeasuredWidth()获取宽度和高度.
     * @param v
     */
    public static void measureView(View v) {
        if (v == null) {
            return;
        }
        int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
        int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
        v.measure(w, h);
    }

}
